﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using CmcWeb;
namespace yd.ControllerBase
{

    public enum AdminHead
    {
        Article = 0,
        User = 1
    }
    /// <summary>
    /// 用于定义管理后台的头部标签
    /// </summary>
    public class AdminHeadFilterAttribute : ActionFilterAttribute
    {
        AdminHead model;
        string title;
        string contents;
        public AdminHeadFilterAttribute(AdminHead _model, string _title, string _contents)
        {
            contents = _contents;
            title = _title;
            model = _model;
        }
        /// <summary>
        /// 進入 Action 的時候執行
        /// </summary>
        /// <param name="filterContext"></param>
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            System.Web.Mvc.ControllerBase controller = filterContext.Controller;
            controller.ViewBag.Enum_Model = model;
            controller.ViewBag.Title = title;
            controller.ViewBag.Contents = contents;

        }
    }
}